As a shared resource of a computer system, a memory system can be simultaneously accessed by multiple application programs. In order for the multiple application programs to implement particular functions in different scenarios, access to memory data needs to be subject to different limitations. For example, to implement a scenario in which device A can only access data stored in device A, an access control function needs to be implemented so that the memory data stored in device A can be distinguished and is restricted in access except for device A.
To enable the access to the memory data to be subject to different limitations, usually different attributes are allocated to the memory data in the memory system. The memory data can be processed only when an attribute carried in a memory access request message matches an attribute of the memory data in the memory system.
In the prior art, a method for implementing a tagged memory is to implement allocation of a memory data attribute at the hardware level. A main idea of the method is: allocating additional memory space to memory data, using the allocated memory space as a tag bit of the memory data, and storing an attribute corresponding to the memory data in the tag bit. In this method, to add an additional and fixed tag to each piece of memory data in the memory system, design of a memory module or a memory chip needs to be modified. However, an existing memory module or memory chip adopts fixed specifications and standards, and costs for modification are relatively high. In addition, in the design process of the memory module or the memory chip, a length of an added tag is usually fixed to ensure that units of storage for storage units are consistent. However, a scenario that can be implemented by using a tag of fixed bits is also limited, which is subject to a specific limitation.
Therefore, it is necessary to design a method in which a tagged memory having multiple functions in multiple application scenarios is supported, without a need of modifying the memory module or the memory chip.